import 'package:fusion_one/dtos/userinfo.dart';
import 'package:fusion_one/redux/actions/userAction.dart';
import 'package:redux/redux.dart';

// 使用 combineReducers 避免写 switch-case
// TypedReducer 的作用就是将 Function 与 Action 关联
final userReducer = combineReducers<UserInfo?>([
  TypedReducer<UserInfo?, SetUserInfoAction>(_setUserInfo),
]);

UserInfo _setUserInfo(UserInfo? userInfo, SetUserInfoAction action) {
  userInfo = action.userInfo;
  return userInfo;
}
